package controlsystem;


import java.io.IOException;
import java.util.HashMap;
import java.util.List;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import managesystem.Student;
	
public class showMilestoneServlet extends HttpServlet {
		/*
		 * Deze klasse regelt het verkeer tussen de jsp milestones en de milestoneController. 
		 * @author Christiaan
		 */
	
	
	private static final long serialVersionUID = 1L;
		/*
		 * 
		 */
		public void doPost(HttpServletRequest req, HttpServletResponse resp)
	            throws IOException {
			
			HashMap<String,Double> milestoneProgress =new HashMap<String,Double>();
			HttpSession session = req.getSession();
			Student currStud = (Student) session.getAttribute("currStud");
			
			List<Milestone> milestones=currStud.getMilestones();
			
			for(Milestone milestone: milestones)
			{
				double progress=MilestoneController.progressMilestone(milestone,currStud);
				milestoneProgress.put(milestone.getCourse().getName(), progress);
			}
			
}
}